package demo8;

import org.w3c.dom.ls.LSOutput;

class OuterClass{
    public int data1=1;
    public static int data2;
    private int data3;

    public void test(){
        System.out.println("OuterClass::test()");
    }

    class InnerClass{
        public int data4=4;
        public static final int data5=5;
        private int data6=6;
        public int data1=111;

        public void test(){
            System.out.println("InnerClass::test()");
            System.out.println(data1);
            System.out.println(OuterClass.this.data1);
            System.out.println(data2);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
        }


    }
}


class Out{

    public int data1=1;
    public static int data2=2;
    private int data3=3;

    static class InnerClass{
        public int data4=4;
        public static int data5=5;
        private int data6=6;

        public void test(){
            System.out.println("InnerClass::test()");
            Out out = new Out();
            System.out.println(out.data1);
            System.out.println(data2);
            System.out.println(out.data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
        }
    }

    public void test(){
        System.out.println("Out::test()");
    }
}

interface IA{
    void test();
}


public class Test {



    public static void main(String[] args) {
        OuterClass outerClass = new OuterClass();
        OuterClass.InnerClass innerClass = outerClass.new InnerClass();
        innerClass.test();

        Out out = new Out();
        Out.InnerClass innerClass1 = new Out.InnerClass();
        innerClass.test();

       IA a= new IA(){
            @Override
            public void test() {
                System.out.println("重写接口的方法");
            }
        };
       a.test();

        new IA(){
            @Override
            public void test() {
                System.out.println("重写接口的方法");
            }
        }.test();
    }
}
